package itheima.d02;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

public class Test {
    public static void main(String[] args) {
        ScheduledExecutorService pool2= Executors.newScheduledThreadPool(2);
        pool2.schedule(()->{
            int sum =0;
            for (int i = 0; i < 10; i++) {
                sum += i;
                System.out.println("累加："+i);

            }
            System.out.println("总和："+sum);
        }, 10, TimeUnit.SECONDS);
    }
}
